package com.ym.domain.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnComment;
import com.gitee.sunchenbin.mybatis.actable.annotation.Index;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableComment;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Table;
import java.time.LocalDateTime;

@Data
@Table
@TableComment("缓存表")
@NoArgsConstructor
@AllArgsConstructor
public class Medis {

    @TableId(type = IdType.ASSIGN_ID)
    @IsKey
    @Column
    @ColumnComment("主键ID")
    private Long id;

    @Index
    @Column(length = 255)
    @ColumnComment("缓存键")
    private String cacheKey;

    @Column(length = 2550)
    @ColumnComment("缓存值")
    private String cacheValue;

    @Column
    @ColumnComment("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Column
    @ColumnComment("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Column
    @ColumnComment("超时时间(秒)")
    private Long expireTime;

}
